home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM A / PD-ROM A.iso / Programming / Programming Languages / XLISP 2.0 / XLISP Tools / Utility (UL) / APL.LSP next >
Encoding:
Lisp/Scheme  |  1988-04-07  |  505 b   |  20 lines  |  [TEXT/ttxt]

  1. ;; Larry Mulcahy 1988
  2. ;; apl
  3.  
  4. (provide 'apl)
  5.  
  6. ; (iota n) = (0 1 2 ... n-1)
  7.  
  8. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  9. ; iota
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12. (defun iota (n) (reverse (iota-helper (1- n))))
  13.  
  14. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  15. ; iota-helper
  16. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17.  
  18. (defun iota-helper (n) (if (>= n 0) (cons n (iota-helper (1- n)))))
  19.  
  20.